// 相对名次
class Solution {
    public:
        static bool fun(pair<int,int> x,pair<int,int> y)
        {
            return x.first > y.first;
        }
        vector<string> findRelativeRanks(vector<int>& score) {
            vector<pair<int,int>> vv;
            int n = score.size();
            for(int i = 0; i < n ; i++)
            {
                vv.emplace_back(score[i],i);
            }      
            sort(vv.begin(),vv.end(),fun);
            vector<string> ret(n);
            for(int i = 0; i < n; i++)
            {
                if(i == 0)
                {
                    ret[vv[i].second] = "Gold Medal";
                }
                else if(i == 1)
                {
                    ret[vv[i].second] = "Silver Medal";
                }
                else if(i == 2)
                {
                    ret[vv[i].second] = "Bronze Medal";
                }
                else
                {
                    ret[vv[i].second] = to_string(i + 1);
                }
            }
            return ret;
        }
    };

    //非递减子序列
    class Solution {
        public:
            vector<int> path;
            vector<vector<int>> ret;
            
            void dfs(vector<int>& nums,int pos)
            {
                if(path.size() >= 2)
                {
                    ret.push_back(path);
                }
                unordered_set<int> uset;
                for(int i = pos;i < nums.size(); i++)
                {
                    if((!path.empty()&& nums[i] < path.back())
                        || uset.find(nums[i]) != uset.end())
                    {
                        continue;
                    }
                    uset.insert(nums[i]);
                    path.push_back(nums[i]);
                    dfs(nums,i+1);
                    path.pop_back();
                }
            }
        
            vector<vector<int>> findSubsequences(vector<int>& nums) {
                dfs(nums,0);
                return ret;
            }
        };